﻿<!--#include file="utf-8.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="seeion.asp"-->
<!--#include file="page.asp"-->
<%
p_type=request("p_type")
if p_type = "Passed" then
	p_id=request("id")
	p_model =request("model")
	set rs=server.createobject("adodb.recordset") 
	exec="select * from news_Comments where ID="&p_id&"" 
	rs.open exec,conn,2,3
	if not rs.eof then
		if p_model=1 then
			rs("IsPassed") = true
		else
			rs("IsPassed") = false
		end if
	end if 
	rs.update
	rs.close
	set rs=nothing
	response.write "<script>window.location.href='Manage_News_Comments.asp'</script>"
	response.end
end if

if p_type = "updatedata" then
	p_id=request("id")
	set rs=server.createobject("adodb.recordset") 
	exec="select * from news_Comments where ID="&p_id&"" 
	rs.open exec,conn,2,3
	rs("user_name") = Trim(request.form("user_name"))
	rs("user_pass") = Trim(request.form("user_pass"))
	rs("Gender") = Trim(request.form("user_Gender"))
	rs("IsPassed") = Trim(request.form("user_IsPassed"))
	rs("IsVIP") = Trim(request.form("user_IsVIP"))
	rs("email") = Trim(request.form("user_email"))
	rs("DateTime") = Trim(request.form("user_DateTime"))
	rs("tel")=Trim(request.form("tel"))
	rs("address")=Trim(request.form("address"))
	rs("qq")=Trim(request.form("qq"))
	rs.update
	rs.close
	set rs=nothing
	response.write "<script>alert('修改成功!')</script>"
	response.write "<script>window.location.href='Manage_News_Comments.asp'</script>"
	response.end
end if

if p_type = "delete" then
	p_id=request("id")
	set rs=server.createobject("adodb.recordset") 
	exec="select * from news_Comments where ID="&p_id&"" 
	rs.open exec,conn,2,3
	rs.delete
	rs.close
	set rs=nothing
	response.write "<script>alert('删除成功!')</script>"
	response.write "<script>history.go(-1)</script>"

'	response.write "<script>window.location.href='Manage_News_Comments.asp'</script>"
	response.end
end if
%>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>列表管理</title>
<link href="images/style.css" type="text/css" rel="stylesheet" />
<style type="text/css">
<!--

-->
</style>
</head>
<body>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
  <tr>
    <td bgcolor="#FFFFFF" class="head">新闻评论管理</td>
  </tr>
</table>
<table width="95%" border="0" align="center" cellpadding="5" cellspacing="0"  class="head_chile">
  <tr>
    <td width="50%"><a href="Manage_news_Comments.asp?action=0">查看全部评论</a>--<a href="Manage_news_Comments.asp?action=1">查看已审核评论</a>--<a href="Manage_news_Comments.asp?action=2">查看未审核评论</a></td>
    <td width="50%" align="right">&nbsp;共<%
	set rs=server.createobject("adodb.recordset")
	sql="select * from news_Comments order by datetime"
	rs.open sql,conn,1,3
	dim num
	num=0
	do while not rs.eof
		num=num+1
		rs.movenext
	loop
	rs.close
	set rs = nothing
	response.write (num)
%>
条评论--<%
	set rs=server.createobject("adodb.recordset")
	sql="select * from news_Comments where IsPassed=true order by datetime"
	rs.open sql,conn,1,3
	num=0
	do while not rs.eof
		num=num+1
		rs.movenext
	loop
	rs.close
	set rs = nothing
	response.write (num)
%>
条已审核--<%
	set rs=server.createobject("adodb.recordset")
	sql="select * from news_Comments where IsPassed=false order by datetime"
	rs.open sql,conn,1,3
	num=0
	do while not rs.eof
		num=num+1
		rs.movenext
	loop
	rs.close
	set rs = nothing
	response.write "<font color=""red"">" & (num) & "</font>"
%>
条未审核</td>
  </tr>
</table>
<br>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FFFFFF">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="cedced">
  <tr bgcolor="e9f1fa">
    <td><table width="100%" border="0" cellpadding="0" cellspacing="0" style="font-family : sans-serif;">
      <tr height="25">
        <td width="70" align="center">ID</td>
        <td width="70">新闻ID</td>
        <td >内容</td>
        <td width="13%" align="center">IP</td>
        <td width="13%" align="center">评论日期</td>
        <td width="60" align="center">审核</td>
        <td width="60" align="center"><a href="javascript:if(confirm('确定要删除该条记录吗?')){window.location.href='#';}else{}">删除</a></td>
      </tr>
    </table></td>
  </tr>
</table>
  <%	
set rs=server.createobject("adodb.recordset") 
exec = "select * from news_Comments "
	if request("action")=1 then
		exec=exec & " where IsPassed =true "
	elseif request("action")=2 then
		exec=exec & " where IsPassed =false "
	else
		exec=exec 
	end if
exec = exec & "order by datetime desc"
'response.write (exec)
'response.end
rs.open exec,conn,1,1 
if rs.eof then
response.Write "&nbsp;暂无数据！"
response.end
else
rs.PageSize =10 '每页记录条数
iCount=rs.RecordCount '记录总数
iPageSize=rs.PageSize
maxpage=rs.PageCount 
page=request("page")
if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if
if page<1 then
page=1
elseif  page>maxpage then
page=maxpage
end if
rs.AbsolutePage=Page
if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if	
%>
  <%For i=1 To x%>
  <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="cedced" style="font-family:sans-serif;margin:5px 0;">
    <tr height="25">
      <td width="70" align="center" bgcolor="#FFFFFF"><%=rs("id")%></td>
      <td width="70" bgcolor="#FFFFFF"><a href="..\page.asp?type=news&id=<%=rs("NewsID")%>" target="_blank"><%=rs("NewsID")%></a></td>
      <td bgcolor="#FFFFFF"><%=rs("Content")%></td>
      <td width="13%" align="center" bgcolor="#FFFFFF"><%=rs("IP")%></td>
      <td width="13%" align="center" bgcolor="#FFFFFF"><%=rs("DateTime")%></td>
      <td width="60" align="center" bgcolor="#FFFFFF"><%
if rs("IsPassed") =true then
response.write "<a href='Manage_News_Comments.asp?p_type=Passed&id="&rs("id")&"&model=0'>取消审核</a>"
else
response.write "<a href='Manage_News_Comments.asp?p_type=Passed&id="&rs("id")&"&model=1'>审核</a>"
end if
%></td>
      <td width="60" align="center" bgcolor="#FFFFFF"><a href="javascript:if(confirm('确定要删除该条记录吗?')){window.location.href='Manage_News_Comments.asp?p_type=delete&id=<%=rs("id")%>';}else{}">删除</a></td>
    </tr>
  </table>
  <%rs.movenext
next
%>
<%
end if
%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><%'以下显示分页
call PageControl(iCount,maxpage,page,"border=0 align=center","<p align=center>")
rs.close
set rs=nothing
%></td>
</tr>
</table>
</body>
</html>
